<template>
  <div>
    <header class="site-header jumbotron">
      <div class="container">
        <div class="row">
          <div class="col-xs-12">
            <h1>请发表对Vue的评论</h1>
          </div>
        </div>
      </div>
    </header>
    <div class="container">
      <Add :addComment="addComment" />
      <List :comments="comments" :deleItem="deleItem"/>
    </div>
  </div>
</template>

<script>

import Add from './components/Add'
import List from './components/List'
export default {
  name: 'App',
  data(){
    return {
      comments:[
        {
          name:'Kobe',
          content:'我是科比哦'
        },
        {
          name :'Wade',
          content:'我是韦德哦'
        }
      ]
    }
  },
  methods:{
    addComment(comment){
      this.comments.unshift(comment)
    },
    deleItem(index){
      this.comments.splice(index,1)
    }
  },
  components: {
    Add,
    List
  }
}
</script>

<style>

</style>
